package red_book.year2024.month4;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * 5 8
 * 1 2 3 4 10
 *
 * 2
 * @author liangchuangchuang
 */
public class AccountTo {
    static int ans=Integer.MAX_VALUE;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[]arr=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=sc.nextInt();
        }
        dfs(arr,0,0,0,m,false);
        System.out.println(ans==Integer.MAX_VALUE?-1:ans);
    }
    public static void dfs(int[]arr, int i, int count, int sum, int target,boolean flag){
        if(count>ans){
            return;
        }
        if(sum>target){
            return;
        }
        if(sum==target){
            ans=Math.min(ans,count);
            return;
        }
        if(i>=arr.length){
            return;
        }
        dfs(arr,i+1,count,sum,target,flag);
        dfs(arr,i+1,count+1,sum+arr[i]/2,target,flag);
        if(!flag){
            dfs(arr,i+1,count+1,sum+arr[i],target,true);
        }
    }
}
